package com.dk.inceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Deacription TODO
 * @Author Lenovo
 * @Date 2020/12/4 22:35
 * @Version 1.0
 **/
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInceptor loginInceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInceptor).addPathPatterns("/**").excludePathPatterns("/login/**","/index");
        //registry.addInterceptor(getHandler());
        //registry.addInterceptor(new LoginInceptor());
    }

    public HandlerInterceptor getHandler(){
        return new LoginInceptor();
    }
}

